package com.zhuangjie.rider.enums;

/**
 * 配送订单状态
 *
 * @author zhuangjie
 * @date 2024/01/21
 */
public enum DeliveryOrderState {
    PENDING_PICKUP(1, "待骑手接单"),
    RIDER_RECEIVED_ORDER(2, "骑手已接单"),
    RIDER_ARRIVED_STORE(3, "骑手已到店"),
    RIDER_PICKED_UP(4, "骑手已取餐"),
    DELIVERED_TO_USER(5, "已交付给用户");

    private final int value;
    private final String description;

    DeliveryOrderState(int value, String description) {
        this.value = value;
        this.description = description;
    }

    public int getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    public static DeliveryOrderState findByCode(int code) {
        for (DeliveryOrderState status : DeliveryOrderState.values()) {
            if (status.getValue() == code) {
                return status;
            }
        }
        return null;
    }
}